#ifdef OSGI_USE_15S_HEADER
#include "../interface/InterfaceDef.h"
#include "osgi-core/osgi-predefined.h"
#else // OSGI_USE_15S_HEADER
#ifndef OSGI_ISERVICEMANAGER_H__
#define OSGI_ISERVICEMANAGER_H__

#include "osgi-predefined.h"
#include "IService.h"

OSGI_NAMESPACE_BEGIN

OSGI_INTERFACE IServiceEnumer
{
	virtual ~IServiceEnumer() {}

	virtual int OSGI_API Count() = 0;
	virtual IService* OSGI_API GetInterface(int index) = 0;
	virtual const char* OSGI_API GetBundleName(int num) = 0;
	virtual const char* OSGI_API GetServiceName(int num) = 0;
	virtual IDictionary* OSGI_API GetServiceAttr(int num) = 0;
	virtual void OSGI_API Destroy() = 0;
};

OSGI_INTERFACE IServiceManager
{
	virtual ~IServiceManager() {}

	//服务注册
	virtual int OSGI_API RegisterService(
		const char* iid, /*接口标识，必填*/
		const IService* ptr, /*接口指针，必填*/
		const char* serviceName,/*服务名称，全局唯一，必填*/
		IDictionary* pServiceAttr /*服务属性，可为NULL*/
		) = 0;

	//服务注销
	virtual int OSGI_API UnRegisterService(
		const char* serviceName /*接口指针，必填*/
		) = 0;

	//单个服务获取
	virtual int OSGI_API GetService(
		const char* iid,/*接口标识，必填*/
		IService** ppInterface, /*返回接口指针，必填*/
		const char* serviceName, /*服务名称，必填*/
		IDictionary* pServiceAttr /*服务属性，可为NULL*/
		) = 0;
	
	//多个服务接口批量查询-获取系统所有满足条件的某个类型的接口
	virtual int OSGI_API GetServices(
		const char* iid,/*接口标识，必填*/
		IDictionary* pServiceAttr,/*服务属性，可为NULL*/
		IServiceEnumer** ppEnumer) = 0;/*返回枚举指针，必填*/

	//多个服务接口批量查询－获取组件所有所有满足条件的某个类型的接口
	virtual int OSGI_API GetServicesOfBundle(
        const char* iid,/*接口标识，必填*/
        const char* bundleName,/* bundle标识，必填*/
		IServiceEnumer** ppEnumer) = 0;/*返回枚举指针*/

	//服务事件监听注册
	virtual int OSGI_API RegisterServiceEventListener(
		IServiceEventListener* pListener) = 0;

	//服务事件监听注销
	virtual int OSGI_API UnRegisterServiceEventListener(
		IServiceEventListener* pListener) = 0;

	//服务事件发布
	virtual int OSGI_API PublishServiceEvent(
		IServiceEvent* event) = 0;
};

OSGI_NAMESPACE_END

#endif // OSGI_ISERVICEMANAGER_H__
#endif // OSGI_USE_15S_HEADER
